package com.bonc.modules.business.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.bonc.modules.business.entity.TbWorkOrderDetailTypeEntity;
import com.bonc.modules.business.service.TbWorkOrderDetailTypeService;
import com.bonc.common.utils.PageUtils;
import com.bonc.common.utils.Result;



/**
 * 工单类型码表
 *
 * @author feiniao
 * @date 2021-10-11 11:15:50
 */
@RestController
@RequestMapping("business/tbworkorderdetailtype")
public class TbWorkOrderDetailTypeController {
    @Autowired
    private TbWorkOrderDetailTypeService tbWorkOrderDetailTypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("business:tbworkorderdetailtype:list")
    public Result list(@RequestParam Map<String, Object> params){
        PageUtils page = tbWorkOrderDetailTypeService.queryPage(params);

        return Result.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{identyType}")
    @RequiresPermissions("business:tbworkorderdetailtype:info")
    public Result info(@PathVariable("identyType") String identyType){
		TbWorkOrderDetailTypeEntity tbWorkOrderDetailType = tbWorkOrderDetailTypeService.getById(identyType);

        return Result.ok().put("tbWorkOrderDetailType", tbWorkOrderDetailType);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("business:tbworkorderdetailtype:save")
    public Result save(@RequestBody TbWorkOrderDetailTypeEntity tbWorkOrderDetailType){
		tbWorkOrderDetailTypeService.save(tbWorkOrderDetailType);

        return Result.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("business:tbworkorderdetailtype:update")
    public Result update(@RequestBody TbWorkOrderDetailTypeEntity tbWorkOrderDetailType){
		tbWorkOrderDetailTypeService.updateById(tbWorkOrderDetailType);

        return Result.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("business:tbworkorderdetailtype:delete")
    public Result delete(@RequestBody String[] identyTypes){
		tbWorkOrderDetailTypeService.removeByIds(Arrays.asList(identyTypes));

        return Result.ok();
    }

}
